/*
 * Copyright© 2003-2019 浙江汇信科技有限公司, All Rights Reserved. 
 */
package com.icinfo.cloud.provider.punish.ucase.casemain.controller;

import com.icinfo.cloud.provider.punish.ucase.casemain.dto.CaseIllegalParkingRecordDto;
import com.icinfo.cloud.provider.punish.ucase.casemain.dto.CaseIllegalParkingRecordRequest;
import com.icinfo.cloud.provider.punish.ucase.casemain.service.ICaseIllegalParkingRecordService;
import com.icinfo.cloud.provider.punish.ucase.casemain.vo.CaseIllegalParkingRecordVo;
import com.icinfo.framework.common.web.Result;
import com.icinfo.framework.core.web.BaseController;
import com.icinfo.framework.mybatis.pagehelper.generic.PageResponse;
import lombok.extern.slf4j.Slf4j;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * 描述: 机动车违停记录表 case_illegal_parking_record 对应的Controller类.<br>
 *
 * @author framework generator
 * @date 2022年12月08日
 */
@RestController
@RefreshScope
@RequestMapping("/punish/ucase/case/illegalParking")
@Slf4j
public class CaseIllegalParkingRecordController extends BaseController {
    /**
     * 日志记录器
     */
    private static final Logger logger = LoggerFactory.getLogger(CaseIllegalParkingRecordController.class);

    @Autowired
    private ICaseIllegalParkingRecordService caseIllegalParkingRecordService;

    /**
     * 获取机动车违停记录列表
     * @param request
     * @return
     */
    @PostMapping("/getIllegalParkingList")
    public Result<PageResponse<CaseIllegalParkingRecordVo>> getIllegalParkingList(@RequestBody CaseIllegalParkingRecordRequest request){
        List<CaseIllegalParkingRecordVo> list = caseIllegalParkingRecordService.getIllegalParkingList(request);
        return Result.success(new PageResponse<>(list));
    }

    /**
     * 新增机动车违停记录
     * @param dto
     * @return
     */
    @PostMapping("/saveIllegalParkingRecord")
    public Result saveIllegalParkingRecord(@RequestBody CaseIllegalParkingRecordDto dto){
        caseIllegalParkingRecordService.saveIllegalParkingRecord(dto);
        return Result.success("新增成功");
    }

    /**
     * 修改机动车违停记录
     * @param dto
     * @return
     */
    @PostMapping("/updateIllegalParkingRecord")
    public Result updateIllegalParkingRecord(@RequestBody CaseIllegalParkingRecordDto dto){
        caseIllegalParkingRecordService.updateIllegalParkingRecord(dto);
        return Result.success("修改成功");
    }

    /**
     * 删除机动车违停记录
     * @param dto
     * @return
     */
    @PostMapping("/deleteIllegalParkingRecord")
    public Result deleteIllegalParkingRecord(@RequestBody CaseIllegalParkingRecordDto dto){
        caseIllegalParkingRecordService.deleteIllegalParkingRecord(dto);
        return Result.success("删除成功");
    }

    /**
     * 获取机动车违停记录详情
     * @param dto
     * @return
     */
    @PostMapping("/getIllegalParkingRecordDetail")
    public Result<CaseIllegalParkingRecordVo> getIllegalParkingRecordDetail(@RequestBody CaseIllegalParkingRecordDto dto){
        return Result.success(caseIllegalParkingRecordService.getIllegalParkingRecordDetail(dto));
    }

}